package live.betterman.system.service.impl;

import live.betterman.system.model.SysPermission;
import live.betterman.system.dao.SysPermissionMapper;
import live.betterman.system.service.SysPermissionService;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.hutool.core.util.StrUtil;

import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhudawei
 * @since 2024-01-10
 */
@Service
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements SysPermissionService {
    
    @Override
    public IPage<SysPermission> page(Page<SysPermission> page, String permissionName) {
        LambdaQueryWrapper<SysPermission> queryWrapper = new LambdaQueryWrapper<>();
        if (StrUtil.isNotEmpty(permissionName)) {
            queryWrapper.like(SysPermission::getPermissionName, permissionName);
        }
        return page(page, queryWrapper);
    }
}
